package compound.pattern;import java.util.ArrayList;import java.util.Iterator;/** * Created by Administrator on 2018-11-8. * 加入组合模式，像对待单个对象一样对待对象集合 */public class Flock implements Quackable {    ArrayList quacks = new ArrayList();    public void quack() {        Iterator iterator = quacks.iterator();        while (iterator.hasNext()){            Quackable quackable = (Quackable)iterator.next();            quackable.quack();        }    }    public void add(Quackable quackers){        quacks.add(quackers);    }    public void registerObserver(Observer observe) {    }    public void notifyObservers() {    }}